Skip to content

feat(cli): refine validate command#433

Merged
bzp2010 merged 3 commits intomainfrom
bzp/feat-refine-validate-cmd
Apr 19, 2026
Merged

feat(cli): refine validate command#433
bzp2010 merged 3 commits intomainfrom
bzp/feat-refine-validate-cmd

Conversation

@bzp2010
Copy link
Copy Markdown
Collaborator

@bzp2010 bzp2010 commented Apr 18, 2026

Description

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

Summary by CodeRabbit

  • Refactor

    • Streamlined validation flow; validation now checks backend version and enforces a minimum supported version (3.9.10).
    • Improved plain-text error formatting for validation failures.
  • Tests

    • Validation tests reorganized to explicitly cover supported and unsupported backend versions.
  • Chores

    • Updated .gitignore pattern for out-tsc directory and normalized a settings file newline.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7de61173-e9ac-4cdd-a9dd-79dd005f951f

📥 Commits

Reviewing files that changed from the base of the PR and between 83fbabd and aaa4e4b.

📒 Files selected for processing (1)
  • libs/backend-api7/e2e/validate.e2e-spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/backend-api7/e2e/validate.e2e-spec.ts

📝 Walkthrough

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Security Check ❌ Error PR introduces information disclosure of backend version number in error messages exposed to users Modify error message in libs/backend-api7/src/validator.ts to use generic message instead of exposing exact version via ${this.opts.version}
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(cli): refine validate command' directly and accurately summarizes the main change: refinement of the validate command in the CLI, as evidenced by modifications to validate.ts and backend API signatures.
E2e Test Quality Review ✅ Passed E2E tests exercise full business flow with real backend, covering version detection, configurations, resource types, error handling, and dry-run scenarios with well-isolated test cases and clear assertions.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bzp/feat-refine-validate-cmd

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@libs/sdk/src/backend/index.ts`:
- Around line 100-102: The Backend interface and BackendAPI7 are mismatched:
tests call backend.supportValidate() but the interface only defines
supportStreamRoute; add an optional supportValidate?: () => Promise<boolean> to
the Backend interface in libs/sdk/src/backend/index.ts and update BackendAPI7 to
implement supportValidate (either by delegating to supportStreamRoute or
returning the correct boolean) so backend.supportValidate() exists at runtime.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98886ecd-6a59-4658-addb-42fd580091e2

📥 Commits

Reviewing files that changed from the base of the PR and between 633fadd and 2157a79.

📒 Files selected for processing (7)
  • .gitignore
  • apps/cli/src/tasks/validate.ts
  • libs/backend-api7/src/index.ts
  • libs/backend-api7/src/validator.ts
  • libs/backend-apisix-standalone/src/index.ts
  • libs/backend-apisix/src/index.ts
  • libs/sdk/src/backend/index.ts
💤 Files with no reviewable changes (2)
  • libs/backend-apisix-standalone/src/index.ts
  • libs/backend-apisix/src/index.ts

Comment thread libs/sdk/src/backend/index.ts
@bzp2010 bzp2010 added the test/api7 Trigger the API7 test on the PR label Apr 18, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@libs/backend-api7/e2e/validate.e2e-spec.ts`:
- Around line 139-140: The assertion is order-dependent by checking
result.errors[0].resource_type; replace it with a membership-style check against
the result.errors array (e.g., assert that result.errors contains at least one
element whose resource_type === 'routes') so the test does not rely on error
ordering; locate the assertions referencing result.errors in the
validate.e2e-spec.ts test and update them to use an existence/contains check
(e.g., Array.prototype.some or an equivalent matcher) instead of indexing [0].
- Line 39: The test uses Jest's .rejects on an Observable (backend.validate([]))
which requires a Promise; change the assertion to wrap the Observable with
lastValueFrom (from 'rxjs') before applying .rejects, i.e. use
lastValueFrom(backend.validate([])) in the expect call; ensure any existing
lastValueFrom imports in the file are used or add the import if missing and keep
the rest of the assertion message ('not supported') unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6cf8e274-485e-4d64-ac70-de6248f5eed9

📥 Commits

Reviewing files that changed from the base of the PR and between 2157a79 and 83fbabd.

📒 Files selected for processing (1)
  • libs/backend-api7/e2e/validate.e2e-spec.ts

Comment thread libs/backend-api7/e2e/validate.e2e-spec.ts Outdated
Comment thread libs/backend-api7/e2e/validate.e2e-spec.ts
@bzp2010 bzp2010 merged commit f01631a into main Apr 19, 2026
31 checks passed
@bzp2010 bzp2010 deleted the bzp/feat-refine-validate-cmd branch April 19, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test/api7 Trigger the API7 test on the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants